package com.gy.algorithm.carl.strexa;

import java.util.Arrays;
import java.util.Scanner;

class RightStr {

    public static void main (String[] args) {
        Scanner in = new Scanner(System.in);
        int n = Integer.parseInt(in.nextLine());
        String s = in.nextLine();
        System.out.println(rightStr(s,n));
    }

    public static char[]  rightStr(String s,int k){
        char[] array = s.toCharArray();
        // 整体翻转
        reverse(array,0,array.length - 1);
        // 局部翻转
        reverse(array,0,k - 1);
        reverse(array,k,array.length - 1);

        return array;
    }

    public static void reverse(char[] arr,int start,int end){
        while(start < end){
            arr[start] ^= arr[end];
            arr[end] ^= arr[start];
            arr[start] ^= arr[end];

            start++;
            end--;
        }
    }

    public static char[]  rightStr1(String s,int k){
        char[] array = s.toCharArray();

        int len = array.length;

        if(k >= len) return array;

        // 需要前置的数组
        char[] chars = new char[k];
        int index = chars.length - 1;
        for (int i = len - 1; i >= len - k; i--) {
            chars[index--] = array[i];
        }

        // 移动数组中的元素
        for (int i = len - 1; i >= k; i--) {
            array[i] = array[i - k];
        }

        // 补足前面组的值
        for (int i = 0; i < chars.length; i++) {
            array[i] = chars[i];
        }

        return array;
    }

}